Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: use transcript composition #115

Merged

Conversation

AaronFeickert
Copy link
Contributor

@AaronFeickert AaronFeickert commented Feb 12, 2024

The library uses Merlin transcripts internally for handling Fiat-Shamir operations. When generating and verifying a proof, the caller provides a label that is used to instantiate the transcript.

This is not particularly idiomatic, because it requires a &'static lifetime for the label, it does not follow Merlin's design recommendations, and it does not support transcript composition. Composition allows a single transcript to be used for multiple sub-protocols safely and flexibly.

This PR makes a breaking change in two ways to support this.

First, it changes the public API to replace transcript labels with mutable references to Merlin transcripts. This means in particular that the caller is responsible for the transcript: it either instantiates a new transcript with a label of its choice, or passes along an existing transcript for composition.

Second, it changes how domain separation is applied to the transcript. The Merlin documentation requires the use of a fixed domain separation message label dom-sep, and recommends its use in composition. The library currently uses a different design that, while safe if transcripts are strictly internal, could cause issues during composition.

If it's desirable for existing proofs to verify, the domain separation change can be reverted, but the documentation should be modified to indicate this nonstandard behavior.

Closes #114.

BREAKING CHANGE: Changes the prover and verifier APIs to replace transcript labels with Merlin transcripts. Changes how domain separation is applied internally.

@AaronFeickert
Copy link
Contributor Author

AaronFeickert commented Feb 12, 2024

Note that this updated design likely makes it easier for callers who want to define overlying protocols and bind context to proofs. To do this, the caller instantiates the transcript (or adds domain separation to an existing transcript) with a protocol-specific label, and then appends one or more messages that establish the context binding in a protocol-defined way.

This avoids the current design's &'static lifetime requirement for the transcript label, which is extremely restrictive and not suitable for this.

Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Just some comments about naming.

src/protocols/transcript_protocol.rs Outdated Show resolved Hide resolved
src/range_proof.rs Outdated Show resolved Hide resolved
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

src/range_proof.rs Show resolved Hide resolved
@hansieodendaal hansieodendaal merged commit 6be2bda into tari-project:main Mar 5, 2024
7 checks passed
@AaronFeickert AaronFeickert deleted the transcript-composition branch March 5, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make transcripts composable
4 participants